package com.gitee.hermer.engine.jars.dependent.disconf.config;

import org.apache.tools.ant.util.ClasspathUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import com.gitee.hermer.boot.jee.commons.reflect.ClassUtils;
import com.gitee.hermer.boot.jee.commons.utils.PropertiesUtils;
import com.gitee.hermer.engine.jars.core.domain.EngineConstant;
import com.gitee.hermer.engine.jars.dependent.dsm.domain.EngineProperties;

@PropertySource(EngineConstant.ENGINE_CONFIG_PROPERTIES_CLASS_PATH)
public class DisconfClientProperties extends EngineProperties {
	@Value(EngineConstant.PROPERTIES_KEY_ENGINE_CONFIG_DSM_APP_NAME)
	private String appName;
	@Value(EngineConstant.PROPERTIES_KEY_ENGINE_CONFIG_DSM_APP_VERSION)
	private String appVersion;
	@Value(EngineConstant.PROPERTIES_KEY_ENGINE_CONFIG_DISCONF_ENABLE_REMOTE)
	private Boolean enableRemote;
	@Value(EngineConstant.PROPERTIES_KEY_ENGINE_CONFIG_DISCONF_CONF_SERVER_HOST)
	private String serverHost;
	@Value(EngineConstant.PROPERTIES_KEY_ENGINE_CONFIG_DISCONF_EVN)
	private String env;
	@Value(EngineConstant.PROPERTIES_KEY_ENGINE_CONFIG_DISCONF_IGNORE)
	private String ignore;
	@Value(EngineConstant.PROPERTIES_KEY_ENGINE_CONFIG_DISCONF_CONF_SERVER_RETRY_TIMES)
	private Integer retryTimes;
	@Value(EngineConstant.PROPERTIES_KEY_ENGINE_CONFIG_DISCONF_CONF_SERVER_RETRY_SLEEP)
	private Integer retrySleep;
	@Value(EngineConstant.PROPERTIES_KEY_ENGINE_CONFIG_DISCONF_USER_DEFINE_DOWNLOAD_DIR)
	private String downloadDir;
	@Value(EngineConstant.PROPERTIES_KEY_ENGINE_CONFIG_DISCONF_SCAN_PACKAGE)
	private String scanPackage;
	
	
	public String getScanPackage() {
		if(scanPackage == null){
			scanPackage = PropertiesUtils.loadProperties(EngineConstant.ENGINE_CONFIG_PROPERTIES_FILE_NAME)
					.getProperty(EngineConstant.PROPERTIES_KEY_ENGINE_CONFIG_DISCONF_SCAN_PACKAGE.substring(2, 
							EngineConstant.PROPERTIES_KEY_ENGINE_CONFIG_DISCONF_SCAN_PACKAGE.length()-1));
		}
		return scanPackage;
	}
	public void setScanPackage(String scanPackage) {
		this.scanPackage = scanPackage;
	}
	
	public String getAppName() {
		return appName;
	}
	public void setAppName(String appName) {
		this.appName = appName;
	}
	public String getAppVersion() {
		return appVersion;
	}
	public void setAppVersion(String appVersion) {
		this.appVersion = appVersion;
	}
	public Boolean getEnableRemote() {
		return enableRemote;
	}
	public void setEnableRemote(Boolean enableRemote) {
		this.enableRemote = enableRemote;
	}
	public String getServerHost() {
		return serverHost;
	}
	public void setServerHost(String serverHost) {
		this.serverHost = serverHost;
	}
	public String getEnv() {
		return env;
	}
	public void setEnv(String env) {
		this.env = env;
	}
	public String getIgnore() {
		return ignore;
	}
	public void setIgnore(String ignore) {
		this.ignore = ignore;
	}
	public Integer getRetryTimes() {
		return retryTimes;
	}
	public void setRetryTimes(Integer retryTimes) {
		this.retryTimes = retryTimes;
	}
	public Integer getRetrySleep() {
		return retrySleep;
	}
	public void setRetrySleep(Integer retrySleep) {
		this.retrySleep = retrySleep;
	}
	public String getDownloadDir() {
		return downloadDir;
	}
	public void setDownloadDir(String downloadDir) {
		this.downloadDir = downloadDir;
	}
}
